class Result {
    constructor(status, message, data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    static success(data = null, message = '操作成功！', status = resultStatus.SUCCESS) {
        return new Result(200, message, data);
    }

    static error(message = '操作失败！', status = resultStatus.ERROR) {
        return new Result(status, message, null);
    }
}

const resultStatus = {
    SUCCESS: 200,
    ERROR: 500,
}

module.exports = {
    Result,
    resultStatus
}
